//
//  PhoneValidator.swift
//  User
//
//  Created by ET|冰琳 on 2017/1/9.
//  Copyright © 2017年 IB. All rights reserved.
//

import Foundation


/// 手机号验证
public class PhoneValidator: NSObject, Validator {
    
    public func validate(txt: String?) -> Bool {
        
        let formate = "^1[3|4|5|7|8][0-9]{9}$"
        let predicate = NSPredicate(format: "SELF MATCHES %@", formate)
        
        let result = predicate.evaluate(with: txt)
        print("\(txt) valide: \(result)")
        return result
    }
}
